<div class="toolcy">
	<div class="tooltop">
        <div class="toolname">
            <h2>常用工具</h2>
        </div>
        <div class="optionbox">
            <ul>
            	<li><a href="/tool/express">国际运费表</a></li>
                <li class="toolon"><a href="javascript:void(0)">上门取货费用试算</a></li>
                <li><a href="/tool/track">物流跟踪查询</a></li>
                <li><a href="/tool/size">尺码换算</a></li>
                <li><a href="/tool/rate">汇率换算</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="smbox">
    <div class="smsstop">
		<div class="smtopc">
        	<div class="smname">
            	<h1>上门取货费用试算</h1>
            </div>
            <div class="smtopr">
            	<dl>
                	<dt><a href="http://help.uuch.com/?p=706">想了解更多上门取货？</a></dt>
                	<dd><a class="button11" href="/store/visiting"><span>立即申请上门取货</span></a></dd>
                </dl>
            </div>
        </div>
    </div>
    <div class="smcen">
    	<div class="smz">
        	<div class="smjsq">
            	<table>
                	<tr>
                    	<td class="jsqz">我要查询：</td>
                    	<td>
                        	<ul class="chax">
                            	<li><label><input name="isWay" id="isWay_0" class="isWay" type="radio" value="0" checked/>只查上门取件费用</label></li>
                            	<li><label><input name="isWay" id="isWay_1" class="isWay" type="radio" value="1" />上门+国际运费</label></li>
                            </ul>
                        </td>
                    </tr>
                	<tr>
                    	<td class="jsqz">物品取件地：</td>
                    	<td>
                            <div class="applyss">
                                <div class="xlselect">
                                    <div class="xllist">
                                        <input class="textinput w150" type="text" id='city_name' name='city_name' value="<?php echo $this->cityAll[0]["name"];?>" readOnly="true" />
                                        <input type='hidden' id='city_id' name='city_id' value='<?php echo $this->cityAll[0]["id"];?>' />
                                        <a href="javascript:void(0)"></a>
                                    </div>
                                    <div class="biaoxllb" style="display:none;" id='city_div'>
                                        <ul>
                                            <?php foreach ($this->cityAll as $cityVal) { ?>
                                                <li><a href="javascript:void(0)" data='<?= $cityVal['id'] ?>'><?php echo $cityVal["name"]; ?></a></li>
                                            <?php } ?>
                                        </ul>
                                    </div>
                                </div>
                                <div class="xlselect">
                                    <div class="xllist">
                                        <input class="textinput w150" type="text" id='town_name' name='town_name' value="<?php echo $this->townAll[0]["name"];?>" readOnly="true" />
                                        <input type='hidden' id='town_id' name='town_id' value='<?php echo $this->townAll[0]["id"];?>' />
                                        <a href="javascript:void(0)"></a>
                                    </div>
                                    <div class="biaoxllb" style="display:none;" id='town_div'>
                                        <ul>
                                            <?php foreach ($this->townAll as $townVal) { ?>
                                                <li><a href="javascript:void(0)" data='<?php echo $townVal["id"]; ?>'><?php echo $townVal["name"]; ?></a></li>
                                            <?php } ?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr style="display:none;" id="DestCtry">
                    	<td class="jsqz">目的国家：</td>
                    	<td>
                            <div class="share_guojiabox">
                                <div class="share_guyojiatext">
                                    <div class="share_xllist">
                                        <input class="textinput w350" type="text" value="<?php echo $this->city->Name;?>" id="cityName" name="cityName" cid="<?php echo $this->city->Id;?>" readonly="true"/>
                                        <a href="javascript:void(0)"></a>
                                    </div>
                                </div>   
                                <div class="share_guojiaceng" style="display:none;">
                                    <div class="share_remen">
                                        <h2>热门国家和地区</h2>
                                        <ul class="share_countrylist">
                                            <li><a href="javascript:void(0)" id="c_us" cid="1">美国</a></li>
                                            <li><a href="javascript:void(0)" cid="2">加拿大</a></li>
                                            <li><a href="javascript:void(0)" cid="3">澳大利亚</a></li>
                                            <li><a href="javascript:void(0)" cid="47">日本</a></li>
                                            <li><a href="javascript:void(0)" cid="39">台湾</a></li>
                                            <li><a href="javascript:void(0)" cid="4">新西兰</a></li>
                                            <li><a href="javascript:void(0)" cid="5">英国</a></li>
                                            <li><a href="javascript:void(0)" cid="42">马来西亚</a></li>
                                        </ul>
                                    </div>
                                    <div class="share_allcountry">
                                        <h2>全部国家和地区</h2>
                                        <ul class="share_countryzm">
                                            <?php  foreach ($this->words as $char) { ?>
                                                <li <?= $char == 'A' ? 'class="share_zmon"' : '' ?>><a href="javascript:void(0)"><?= $char ?></a></li>
                                            <?php }  ?>
                                        </ul>
                                        <div id="countryTab">
                                        <?php  foreach ($this->words as $char) { ?>
                                            <ul class="share_countrylist"  <?= $char == 'A' ? '' : 'style="display:none"' ?>>
                                                <?php $citys = Application_Model_city::GetBySortCode($char);
                                                        foreach ($citys as $city) { ?>
                                                        <li ><a href="javascript:void(0)" cid="<?= $city->Id ?>"><?= $city->Name ?></a></li>
                                                <?php } ?>
                                            </ul>
                                        <?php } ?>
                                        </div>
                                    </div>
                                </div>
                            </div>   
                        </td>
                    </tr>
                    <tr>
                        <td class="jsqz">物品重量：</td>
                        <td>
                            <div class="smkg"><input class="textinput w150" type="text" name="weight" id="weight" value=""   onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')"/><em>kg</em></div>
                        </td>
                    </tr>
                    <tr>
                    	<td class="jsqz">物品体积：</td>
                    	<td>
                            <div class="smchi"><input class="textinput w80" type="text" value="" name="length" id="length" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>
                                <span>X</span><input class="textinput w80" type="text" value="" name="width" id="width" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>
                                <span>X</span><input class="textinput w80" type="text" value="" name="hight" id="height" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/><em>cm</em></div>
                        </td>
                    </tr>
                </table>
                <div class="smss">
                    <a href="javascript:void(0)" id="cult"><span>开始试算</span></a>
                </div>
            </div>
            <div class="smgg">
                <ul>
                    <li><a href="/purchase/index"><img src="/images/tool/gg11.png" alt="悠奇代购服务，为海外华人代购中国商品，免手续费" /></a></li>
                </ul>
            </div>
        </div>
    </div>
  
    <div class="smxia">
    	<div class="smjg">
            <div class="smjiantou" style="display: none;"></div>
            <div class="loading" style="display:none;">
                <h4><img src="/images/share/032.gif" alt="正在为您计算价格..." /></h4>
                <p>正在为您计算运费价格....</p>
            </div>
            
            <div class="smguoji" style="display:none">
            	
            </div>
            
            

            <div class="jbbg" style="display: none;">
                <div class="smtj">
                    <span>例：您的试算条件</span>【取件地：<?= $this->townAll[0]["name"] ?> / 重量：20kg / 尺寸：20*20*30cm 】
                </div>
            	<table>
                    <tr>
                    	<th class="sm1">上门取件类型</th>
                        <th class="sm2">有无体积重量</th>
                        <th class="sm3">计费重量</th>
                        <th class="sm5">取货费用</th>
                        <th class="sm4">取货时间</th>
                        <th class="sm6">操作</th>
                    </tr>
                    <?php foreach ($this->prices as $item) {
                        if ($item->Express->IsSpecific)
                        continue; ?>
                        <tr>
                            <td class="sm1"><a href="<?php echo $item->Express->helpUrl;?>" title="了解<?= $item->Express->Name ?>" target="_blank"><?= $item->Express->Name ?></a></td>
                            <td class="sm2"><?php echo $item->Express->isVolume==1?'<span class="smyou">有</span>':'<span class="smwu">无</span>'; ?></td>
                            <td class="sm3">20kg</td>
                            <td class="sm5">￥<?= number_format($item->FirstPrice + $item->Price5 * 19, 2) ?></td>
                            <td class="sm4"><?= $item->times ?>天</td>
                            <td class="sm6"><a class="button11" href="/store/visiting"><span>立即申请取货</span></a></td>
                        </tr>
                    <?php } ?>
                </table>
            </div>
        </div>
        <div class="smask">
            <div class="smxleft">
                <div class="smh2">
                    <h2>发国际快递包裹后需注意的</h2>
                </div>
                <ul>
                    <li>1. <a href="http://help.uuch.com/?p=720" target="_blank">快递员未及时上门取件怎么办？</a></li>
                    <li>2. <a href="http://help.uuch.com/?p=721" target="_blank">快递员上门时需要注意什么？</a></li>
                    <li>3. <a href="http://help.uuch.com/?p=718" target="_blank">怎样提交我的国际运单？</a></li>
                    <li>4. <a href="http://help.uuch.com/?p=723" target="_blank">如何进行国际快递追踪？</a></li>
                    <li>5. <a href="http://help.uuch.com/?p=725" target="_blank">国际包裹延误后如何处理？</a></li>
                    <li>6. <a href=" http://help.uuch.com/?p=706" target="_blank">国际快递特别声明？</a></li>
                </ul>
            </div>
            <div class="smxright">
                <div class="smh2">
                    <h2>发国际快递前您需了解的</h2>
                </div>
                <ul>
                    <li>1. <a href="http://help.uuch.com/?p=706" target="_blank">悠奇上门取货国际快递服务流程！</a></li>
                    <li>2. <a href="http://help.uuch.com/?p=708" target="_blank">哪些物品不能上门取货！</a></li>
                    <li>3. <a href="http://help.uuch.com/?p=711" target="_blank">上门取货时间周期！</a></li>
                    <li>4. <a href="http://help.uuch.com/?p=713" target="_blank">关于上门取货物品重量及体积重量！</a></li>
                    <li>5. <a href="http://help.uuch.com/?p=715" target="_blank">国际快递运费是怎么计算的？</a></li>
                    <li>6. <a href=" http://help.uuch.com/?p=706" target="_blank">悠奇国际运费为何能如此便宜？</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function(){
    $(".xllist").click(function(){
        $(".xllist").next("div").hide();
        $(this).next("div").show();
    });
    $(".isWay").change(function(){
       var isWay = $(".isWay:checked").val();
       if(isWay == 1){
           $("#DestCtry").show();
       }else{
           $("#DestCtry").hide();
       }
       if($('#weight').val()!=''){
            $('#cult').click();
       }
    });
    $('.share_guojiabox').hover(function(){
       
    },function(){
        $('.share_guojiaceng').hide();
    }).click(function(){
         $('.share_guojiaceng').show();
        _gaq.push(['_trackEvent', '运费计算', '打开选择', 'shipfee']);
    });
    $('.share_countrylist a').bind('click',function(){
        var city =$(this).text();
        _gaq.push(['_trackEvent', '运费计算', '点击国家', city]);
        $('#cityName').val(city);
        $('#cityName').attr('cid', $(this).attr('cid'));
        $('.share_guojiaceng').hide();
        
//        CityIdAndTownIdByMoney();
        return false;
    });
    $('.share_countryzm a').each(function(index,item){
        $(item).click(function(){
            _gaq.push(['_trackEvent', '运费计算', '选择字母', $(item).text()]);
            $('.share_countryzm li.share_zmon').removeClass('share_zmon');
            $(this).parent().addClass('share_zmon');
            $('#countryTab ul').hide();
            $('#countryTab ul').eq(index).show();
            return false;
        });
    });
   
    $('#city_div ul a').bind("click",function(){
        $(this).parents('.xlselect').find('.xllist input[id="city_name"]').val($(this).text());
        var cityId = $(this).attr("data");
        $(this).parents('.xlselect').find('.xllist input[id="city_id"]').val(cityId);
        _gaq.push(['_trackEvent', '国内运费计算', '点击省份', cityId]);
        CityByTown(cityId);
    });   
    $('#town_div ul a').live("click",function(){
        $(this).parents('.xlselect').find('.xllist input[id="town_name"]').val($(this).text());
        var townId = $(this).attr("data");
        $(this).parents('.xlselect').find('.xllist input[id="town_id"]').val(townId);
        $(".xllist").next("div").hide();
        _gaq.push(['_trackEvent', '国内运费计算', '点击城市', townId]);
        $(".loading").show();
        $(".jbbg").hide();
        CityIdAndTownIdByMoney();
    });
    $('#cult').click(function(){
        if($('#weight').val()==''){
            alert('请输入货物重量！');
            $('#weight').focus();
            return ;
        }
        $(".loading").show();
        $(".jbbg").hide();
        $(".smjiantou").show();
        post={};
        var input = ['weight','length','width','height'];
        for(var i=0;i<input.length;i++){
            if($('#'+input[i]).val()=='')
                continue;
            if(!/^\d+\.?\d*$/.test($('#'+input[i]).val())){
                alert(input[i]+'对不起，请输入正确的数字！');
                $('#'+input[i]).focus();
                return ;
            }
            post[input[i]]=$('#'+input[i]).val();
        }
        post['cityId'] = $('#city_id').val();
        post['townId'] = $('#town_id').val();
        post['countryId'] = $("#cityName").attr("cid");
        post["isWay"] = $(".isWay:checked").val();
        post["cId"] = $("#cityName").attr("cid");
        $('#cult').html('<span>正在计算···</span>');
        $.post('/tool/visitingcult', post, function(data){
            $('.jbbg').html(data);
            $('#cult').html('<span>开始计算</span>');
            $(".loading").hide();
            $(".jbbg").eq(0).show();
        }, 'html');
    });
    function CityByTown(cityId)
    {
        $.ajax({    
            type: 'POST',
            url: '/store/citysubtown/cityid/'+cityId,
            success: function(data) {
                if(data.arrtown){
                    var html = "";
                    $.each(data.arrtown, function(key, val) {
                        if(key == 0){
                            $("#town_name").val(val.name);
                            $("#town_id").val(val.id)
                        }
                        html+= '<li><a href="javascript:void(0)" data="'+val.id+'" >'+val.name+'</a></li>';
                    });
                    $("#town_div ul").html(html);
                 }
                 $(".xllist").next("div").hide();
                 $(".loading").show();
                 $(".jbbg").hide();
                 CityIdAndTownIdByMoney();
            }
        });
    }
    function CityIdAndTownIdByMoney()
    {
        var post={};
        post['cityId'] = $('#city_id').val();
        post['townId'] = $('#town_id').val();
        post["isWay"] = $(".isWay:checked").val();
        post["cId"] = $("#cityName").attr("cid");
        $.post('/tool/visitingdetail', post, function(html){
            $('.jbbg').html(html);
        }, 'html');
        $(".loading").hide();
        $(".jbbg").show();
    }
    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".xlselect").length == 0){
            $(".xllist").next("div").hide();
        }
   });
});    
</script>